const path = require("path");
const AutoImport = require("unplugin-auto-import/webpack");
const Components = require("unplugin-vue-components/webpack");
const { ElementPlusResolver } = require("unplugin-vue-components/resolvers");
const ElementPlus = require("unplugin-element-plus/webpack");

const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,

  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
      ElementPlus(),
    ],
  },
  chainWebpack: (config) => {
    config.resolve.alias
      .set("@", path.resolve(__dirname, "src"))
      .set("views", "@/views")
      .set("service", "@/service");
  },
  // devServer: {
  //   proxy: {
  //     "/api": {
  //       // 目标 API 地址
  //       target: "127.0.0.1:8888", //真实的api地址
  //       // 如果要代理 websockets
  //       // ws: true,
  //       // 将主机标头的原点更改为目标URL
  //       changeOrigin: true,
  //       pathRewrite: {
  //         "^/api": "/",
  //       },
  //     },
  //   },
  // },
});
